/**
 * 
 */
package com.yidu.springbootdemo.permission.service;

import com.yidu.springbootdemo.permission.action.vo.TrolesModulesVo;
import com.yidu.springbootdemo.permission.dao.TrolesModulesMapper;
import com.yidu.springbootdemo.permission.domain.TrolesModules;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *	类的描述：	角色模块service接口实现类
 * @author HJJ
 * @date 2019年9月25日 下午3:25:11
 */
@Service
public class TrolesModulesServiceImp implements TrolesModulesService {
	
	@Resource
	TrolesModulesMapper trolesModulesMapper;

	@Override
	public void add(TrolesModules tro) {
		trolesModulesMapper.insertSelective(tro);
		
	}

	@Override
	public void delete(String chaID) {
		trolesModulesMapper.delete(chaID);
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<TrolesModulesVo> findAll(String chaID) {
		List<TrolesModules> list = trolesModulesMapper.findAll(chaID);
		List<TrolesModulesVo> list2 = new ArrayList<TrolesModulesVo>();
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			TrolesModules trolesModules = (TrolesModules) iterator.next();
			TrolesModulesVo vo = new TrolesModulesVo();
			vo.setChaId(trolesModules.getTch().getChaId());
			vo.setModId(trolesModules.getTmo().getModId());
			vo.setRolId(trolesModules.getRolId());
			list2.add(vo);
		}
		return list2;
	}

	@Override
	public TrolesModules findByID(String chaID) {
		// TODO Auto-generated method stub
		return null;
	} 
	
}
